﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Udp.Test.Client
{
    class Program
    {
        static int count = 0;
        static void Main(string[] args)
        {
            PlutoStudio.Net.Udp.UpdClient client = new PlutoStudio.Net.Udp.UpdClient();
            Console.WriteLine(client.LocalEndPoint);
            client.Received += client_Received;
            Console.ReadLine();
        }

        static void client_Received(object sender, PlutoStudio.Net.ReceivedEventArgs e)
        {
            var client = sender as PlutoStudio.Net.Udp.UpdClient;
            var content = Encoding.UTF8.GetString(e.Message.Data);
            Console.WriteLine("接收到消息:{0},{1},{2}", e.Message.Flag, e.Message.Code, content);
            Console.WriteLine("接收到{0}条消息", System.Threading.Interlocked.Increment(ref count));
        }
    }
}
